function Vertices(){
	this.polygons = [];
	
	this.reset = function(){
		this.polygons = [];
	};
	
	this.arrayToRGB = function(arr) {
		if( arr.length == 3 ) {
			return "rgb(" + arr[0] + "," + arr[1] + "," + arr[2] + ")";
		}
		return "rgb(0,0,0)";
	};
	
	this.loadModel = function(shape){
		for(var i=0; i < shape.faces.length; i++){
			var f = shape.faces[i];
			var coordinatsArray = [];
			for(var k=0; k<f.length; k++){
				coordinatsArray.push(shape.coordinats[f[k]]);
			}
			var p = new Polygon();
			p.points = coordinatsArray;
			if(shape.colors[i].length > 0){
				p.visible = true;
			}
			p.color = this.arrayToRGB(shape.colors[i]);
			p.renderMethod = shape.renderMethod;
			p.faceId = i;
			
				
			var index = this.polygons.push(p)-1;
			this.polygons[index].id = index;
			this.polygons[index].parent = shape.id;
			shape.polygons.push(index);
		}
		return index;
	};
	
	/*this.removeModel = function(m){
		//console.log(m);
		for(var k=0; k < m.polygons.length; k++){
			for(var i=0; i < this.subjects.length; i++){
				if(this.subjects[i].parent == m.id){
					this.remove(i);
				}
			}
		}

	};*/
}